import { SelectOption } from 'naive-ui'

const list: SelectOption[] = [
  {
    label: '不为空',
    value: 'noeqEmpty'
  },
  {
    label: '等于',
    value: 'eq'
  },
  {
    label: '不等于',
    value: 'noeq'
  },
  {
    label: '大于',
    value: 'gt'
  },
  {
    label: '小于',
    value: 'lt'
  },
  {
    label: '包含',
    value: 'includes'
  },
  {
    label: '不包含',
    value: 'noincludes'
  }
]

export default list

export function getWayName(value: string) {
  const info = list.find((el: SelectOption) => el.value === value)
  return info?.label || value
}

export function getWayOptins(value: string) {
  if (value === 'string') {
    return list.filter((el: SelectOption) => {
      return ['noeqEmpty', 'eq', 'noeq', 'includes', 'gt', 'lt', 'noincludes'].includes(
        <string>el.value
      )
    })
  } else if (value === 'number') {
    return list.filter((el: SelectOption) => {
      return ['noeqEmpty', 'eq', 'noeq', 'gt', 'lt', 'includes', 'noincludes'].includes(
        <string>el.value
      )
    })
  } else if (value === 'boolean') {
    return list.filter((el: SelectOption) => {
      return ['noeqEmpty', 'eq', 'noeq'].includes(<string>el.value)
    })
  }
  return list
}
